home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Night Owl 9
/
Night Owl CD-ROM (NOPV9) (Night Owl Publisher) (1993).ISO
/
019a
/
splt_bat.zip
/
EDIT.BAT
next >
Wrap
DOS Batch File
|
1993-03-25
|
4KB
|
188 lines
@ECHO OFF
IF "%1"=="" GOTO LoadEdit
IF NO EXIST %1 GOTO LoadEdit
SET PathName=%1
cls
SET OldPath=%Path%
PATH=%1
SET UpCase=%Path%
SET Path=%OldPath%
echo 23H
Please wait; loading
%UpCase%
SET OldPath=
SET UpCase=
:PathSeek
SET Prev=%PathName%
FOR %%a IN (/%pathName%) DO SET PathName=%%a
IF "\%PathName%"=="%Prev%" GOTO PathFound
SET Count=%Count%x
IF NOT "%PathName%"=="%Prev%" GOTO PathSeek
SET FileName=%1
SET PathName=
GOTO SetExt
:PathFound
SET PathName=%1■
SET Count=
SET BackCount=
:PathLength
SET Prev=%PathName%
FOR %%a IN (/%PathName%) DO SET PathName=%%a
FOR %%a IN (/%Prev%) DO IF "%%a"=="\" GOTO BackSlash
FOR %%a IN (/%Prev%) DO IF "%%a"=="■" GOTO FileSetup
SET Count=%Count%x
REM ECHO Value of PathName is %PathName%
REM ECHO Value of Count %Count%
GOTO PathLength
:BackSlash
REM ECHO VALUE OF PATHNAME IS %PathName%
SET BackCount=%BackCount%x
GOTO PathLength
:FileSetup
SET FileName=%1
SET BkCount=
:FileGet
SET Prev=%FileName%
FOR %%a IN (/%FileName%) DO SET FileName=%%a
FOR %%a IN (/%Prev%) DO IF "%%a"=="\" GOTO Back
REM ECHO Value of FileName is %FileName%
GOTO FileGet
:Back
REM ECHO VALUE OF FileName IS %FileName%
SET BkCount=%BkCount%x
IF NOT "%BkCount%"=="%BackCount%" GOTO FileGet
SET TempFile=%FileName%■
SET Count=
:FileLength
SET Prev=%TempFile%
FOR %%a IN (/%TempFile%) DO SET TempFile=%%a
FOR %%a IN (/%Prev%) DO IF "%%a"=="■" GOTO PathSetup
SET Count=%Count%x
REM ECHO Value of TempFile is %TempFile%
REM ECHO Value of Count is %Count%
GOTO FileLength
:PathSetup
SET Count=%Count%x
SET PathName=%1
SET BkCount=
SET File=
SET TempFile=
:PathGet1
SET Prev=%PathName%
FOR %%a IN (/%PathName%) DO SET PathName=%%a
FOR %%a IN (/%Prev%) DO IF "%%a%PathName%"=="%Prev%" SET PathName=%PathName%%%a
FOR %%a IN (/%Prev%) DO IF "%%a"=="\" GOTO BackAgain
REM ECHO Value of PathName is %PathName%
GOTO PathGet1
:BackAgain
REM ECHO VALUE OF PATHNAME IS %PathName%
SET BkCount=%BkCount%x
IF NOT "%BkCount%"=="%BackCount%" GOTO PathGet1
SET Counter=
:PathGet2
FOR %%a IN (/%PathName%) DO SET PathName=%%a
SET Counter=%Counter%x
REM ECHO VALUE OF PATHNAME IS %PathName%
IF NOT "%Counter%"=="%Count%" GOTO PathGet2
SET Counter=
SET Count=
SET BkCount=
SET BackCount=
:SetExt
SET Ext=%FileName%
:ExtCheck
SET Prev=%Ext%
FOR %%a IN (/%Ext%) DO SET Ext=%%a
IF ".%Ext%"=="%Prev%" GOTO ExtFound
REM ECHO Value of Ext is %Ext%
SET Count=%Count%x
IF NOT "%Ext%"=="%Prev%" GOTO ExtCheck
SET Name=%FileName%
SET Ext=
GOTO NoExt
:ExtFound
SET Prev=
SET Len=
SET NewExt=%Ext%■
:FindLen
FOR %%a IN (/%NewExt%) DO SET NewExt=%%a
SET Len=%Len%x
IF NOT "%NewExt%"=="■" GOTO FindLen
SET NewExt=
SET Name=%FileName%
SET NewCount=
:ChopExt
SET Prev=%Name%
FOR %%a IN (/%Name%) DO SET Name=%%a
FOR %%a IN (/%Prev%) DO IF "%%a%Name%"=="%Prev%" SET Name=%Name%%%a
REM ECHO Value of Name is %Name%
SET NewCount=%NewCount%x
IF NOT "%Count%"=="%NewCount%" GOTO ChopExt
SET NewCount=
SET NewLen=
:GetName
SET Prev=%Name%
FOR %%a IN (/%Name%) DO SET Name=%%a
REM ECHO Value of Name is %Name%
SET NewLen=%NewLen%x
IF NOT "%NewLen%"=="%Len%x" GOTO GetName
SET NewLen=
SET Len=
:NoExt
SET FileName=
SET Count=
SET Prev=
:CopyTemp
COPY %1 %Name%.$$$>NUL
SET Exists=1
:LoadEdit
C:\DOS\EDIT %1
IF "%1"=="" GOTO End
IF "%Exists%"=="" GOTO End
:FilComp
FC %1 %Name%.$$$>E:\TEMP$$$$.$$$
FIND /N "FC: no differences encountered" < E:\TEMP$$$$.$$$ > E:\COMP$$$.$$$
IF EXIST E:\TEMP$$$$.$$$ ERASE E:\TEMP$$$$.$$$
COPY E:\COMP$$$.$$$ E:\COMP$$$$.$$$ > NUL
IF EXIST E:\COMP$$$$.$$$ ERASE E:\COMP$$$.$$$
IF NOT EXIST E:\COMP$$$$.$$$ GOTO RenBak
IF EXIST %Name%.$$$ ERASE %Name%.$$$
GOTO End
:RenBak
IF EXIST %Name%.BAK ERASE %Name%.BAK
IF EXIST %Name%.$$$ REN %Name%.$$$ %Name%.BAK
IF EXIST E:\COMP$$$$.$$$ ERASE E:\COMP$$$$.$$$
:End
SET Pathname=
SET Name=
SET Ext=
SET Exists=